<!DOCTYPE html>
<html lang="zh-cn">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>随即输出所有人的名字</title>
</head>

<body>

</body>

</html>
<script>
    let names = ['李昊哲', '刘晓兰', 'phoenix', '小兰兰'];
    let count = names.length;
    for (let index = 0; index < count; index++) {
        //生成随机数
        let n = Math.floor(Math.random() * names.length);
        window.console.log(names[n]);
        //移除随机数
        names.splice(n, 1);
    }
</script>